<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
<script src="<?php //echo Yii::app()->request->baseUrl;  ?>/js/jsImgSlider/themes/6/mcVideoPlugin_1.js" type="text/javascript"></script>
        <script src="<?php //echo Yii::app()->request->baseUrl;  ?>/js/jsImgSlider/themes/6/js-image-slider_1.js" type="text/javascript"></script>
        
-->
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="language" content="en" />
        <title><?php echo CHtml::encode($this->pageTitle); ?></title>
        <link rel="shortcut icon" href="<?php echo Yii::app()->request->baseUrl; ?>/icon/favicon.ico" type="image/x-icon" />
        <!-- blueprint CSS framework -->
        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/home/css.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/home/cssmenu.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/home/buttons.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/home/pager.css" />
        <link href="<?php echo Yii::app()->request->baseUrl; ?>/css/home/menuV2.css" rel="stylesheet" type="text/css" />

        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

        <link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/js/flexslider/flexslider.css" type="text/css" media="screen" />

        <!-- Modernizr -->
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/flexslider/modernizr.js"></script>

        <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/home/menuV2.js" type="text/javascript"></script>
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/home/jquery.countdown.js" type="text/javascript"></script>
        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/skins/tango/skin.css" />

        <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/productslider/jquery.jcarousel.min.js"></script>


        <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.msgBox/Scripts/jquery.msgBox.js"></script>
        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.msgBox/Styles/msgBoxLight.css" />
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/ui/jquery-ui.js"></script>
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/jPages/jPages.js"></script>

        <script language="javascript">
            var ROOT = "<?php echo Yii::app()->request->baseUrl; ?>/";
            var DIR_IMAGE = "/image";
            var cmd = "vnTRUST";
        </script>
      
        <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/animate.js"></script>
    
        <script>
         $(function() {
             $("#tabs").tabs();
         });
        </script>
        <script>
            /* when document is ready */
            $(function() {

                /* initiate the plugin */
                $("div.holder0").jPages({
                    containerID: "itemContainer0",
                    perPage: 15,
                    startPage: 1,
                    startRange: 1,
                    midRange: 5,
                    endRange: 1
                });

                $("div.holder").jPages({
                    containerID: "itemContainer",
                    perPage: 15,
                    startPage: 1,
                    startRange: 1,
                    midRange: 5,
                    endRange: 1
                });

                $("div.holdera").jPages({
                    containerID: "itemContainera",
                    animation: "rollIn",
                    perPage: 7,
                    startPage: 1,
                    startRange: 1,
                    midRange: 5,
                    endRange: 1,
                    pause: 4000,
                    clickStop: true
                });

            });
        </script>
        <script type="text/javascript">
            /*
             window.onresize = resize;
             
             function resize()
             {
             var $winwidth = $(window).width();
             alert($winwidth);
             
             $(window).resize(function() {
             var $winwidth = $(window).width();
             
             if ($winwidth > 1349) {
             var freeSpace = $winwidth - 381;
             $("#col").width(freeSpace);
             } else
             {
             var freeSpace = 968;
             $("#col").width(freeSpace);
             }
             
             
             // alert(freeSpace);
             });
             $(window).trigger('resize');
             }*/
            function resize()
            {
                var $winwidth = $(window).width();

                if ($winwidth > 1349) {
                    var freeSpace = $winwidth - 381;
                    $("#nd").width($winwidth);
                    $("#head").width($winwidth);
                    $("#col").width(freeSpace);
                } else
                {
                    var freeSpace = 968;
                    $("#nd").width(1349);
                    $("#head").width(1349);
                    $("#col").width(freeSpace);
                }

            }



            $(document).ready(function() {
                $('a.login-window').click(function() {

                    // Getting the variable's value from a link 
                    var loginBox = $(this).attr('href');

                    //Fade in the Popup and add close button
                    $(loginBox).fadeIn(300);

                    //Set the center alignment padding + border
                    var popMargTop = ($(loginBox).height() + 24) / 2;
                    var popMargLeft = ($(loginBox).width() + 24) / 2;

                    $(loginBox).css({
                        'margin-top': -popMargTop,
                        'margin-left': -popMargLeft
                    });

                    // Add the mask to body
                    $('body').append('<div id="mask"></div>');
                    $('#mask').fadeIn(300);

                    return false;
                });

                // When clicking on the button close or the mask layer the popup closed
                $('a.close, #mask').live('click', function() {
                    $('#mask , .login-popup').fadeOut(300, function() {
                        $('#mask').remove();
                    });
                    return false;
                });
            });
            /*
             $(document).ready(function()
             {
             
             var str = document.getElementById("content1").innerHTML;
             var res = str.replace(/salesmartlink/gi, "<a style='color:#428bca;text-decoration: none' href='http://salesmartlink.com/'>Salesmartlink</a>");
             document.getElementById("content1").innerHTML = res;
             
             var str1 = document.getElementById("content0").innerHTML;
             var res1 = str1.replace(/salesmartlink/gi, "<a style='color:#428bca;text-decoration: none' href='http://salesmartlink.com/'>Salesmartlink</a>");
             document.getElementById("content0").innerHTML = res1;
             
             });
             */
        </script>

        <script type="text/javascript">
            // snowStorm.snowColor = '#99ccff'; // màu của tuyết - ở đây là màu xanh xám
            // snowStorm.flakesMaxActive = 96; // số lượng tuyết rơi cùng 1 lúc
            // snowStorm.useTwinkleEffect = true; // cho tuyết nhấp nháy

            //Configure below to change URL path to the snow image
            var snowsrc = "snow.gif"
            // Configure below to change number of snow to render
            var no = 10;
            // Configure whether snow should disappear after x seconds (0=never):
            var hidesnowtime = 0;
            // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
            var snowdistance = "pageheight";

///////////Stop Config//////////////////////////////////

            var ie4up = (document.all) ? 1 : 0;
            var ns6up = (document.getElementById && !document.all) ? 1 : 0;

            function iecompattest() {
                return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body
            }

            var dx, xp, yp;    // coordinate and position variables
            var am, stx, sty;  // amplitude and step variables
            var i, doc_width = 800, doc_height = 600;

            if (ns6up) {
                doc_width = self.innerWidth;
                doc_height = self.innerHeight;
            } else if (ie4up) {
                doc_width = iecompattest().clientWidth;
                doc_height = iecompattest().clientHeight;
            }

            dx = new Array();
            xp = new Array();
            yp = new Array();
            am = new Array();
            stx = new Array();
            sty = new Array();
            snowsrc = (snowsrc.indexOf("http://chomoionline.com/") != -1) ? "snow3.gif" : snowsrc
            for (i = 0; i < no; ++i) {
                dx[i] = 0;                        // set coordinate variables
                xp[i] = Math.random() * (doc_width - 50);  // set position variables
                yp[i] = Math.random() * doc_height;
                am[i] = Math.random() * 20;         // set amplitude variables
                stx[i] = 0.02 + Math.random() / 10; // set step variables
                sty[i] = 0.7 + Math.random();     // set step variables
                if (ie4up || ns6up) {
                    if (i == 0) {
                        document.write("<div id=\"dot" + i + "\" style=\"POSITION: absolute; Z-INDEX: " + i + "; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='http://chomoionline.com/snow3.gif' border=\"0\"><\/a><\/div>");
                    } else {
                        document.write("<div id=\"dot" + i + "\" style=\"POSITION: absolute; Z-INDEX: " + i + "; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='http://chomoionline.com/snow.gif' border=\"0\"><\/div>");
                    }
                }
            }

            function snowIE_NS6() {  // IE and NS6 main animation function
                doc_width = ns6up ? window.innerWidth - 10 : iecompattest().clientWidth - 10;
                doc_height = (window.innerHeight && snowdistance == "windowheight") ? window.innerHeight : (ie4up && snowdistance == "windowheight") ? iecompattest().clientHeight : (ie4up && !window.opera && snowdistance == "pageheight") ? iecompattest().scrollHeight : iecompattest().offsetHeight;
                for (i = 0; i < no; ++i) {  // iterate for every dot
                    yp[i] += sty[i];
                    if (yp[i] > doc_height - 50) {
                        xp[i] = Math.random() * (doc_width - am[i] - 30);
                        yp[i] = 0;
                        stx[i] = 0.02 + Math.random() / 10;
                        sty[i] = 0.7 + Math.random();
                    }
                    dx[i] += stx[i];
                    document.getElementById("dot" + i).style.top = yp[i] + "px";
                    document.getElementById("dot" + i).style.left = xp[i] + am[i] * Math.sin(dx[i]) + "px";
                }
                snowtimer = setTimeout("snowIE_NS6()", 10);
            }

            function hidesnow() {
                if (window.snowtimer)
                    clearTimeout(snowtimer)
                for (i = 0; i < no; i++)
                    document.getElementById("dot" + i).style.visibility = "hidden"
            }


            if (ie4up || ns6up) {
                snowIE_NS6();
                if (hidesnowtime > 0)
                    setTimeout("hidesnow()", hidesnowtime * 1000)
            }

        </script>


        <script type="text/JavaScript">
            /*
            $(document).ready(function myFunction()
            {
            var innerHeight = document.getElementById('p11').clientHeight;
            //alert(innerHeight);
            if(innerHeight<5000){
            document.getElementById("p11").style.visibility = "hidden";
            }
            });*/

            //nocopy
            function killCopy(e){
            return false
            }
            function reEnable(){
            return true
            }
            document.onselectstart=new Function ("return false")
            if (window.sidebar){
            document.onmousedown=killCopy
            document.onclick=reEnable
            }
            //no mouse
            var message="NoRightClicking"; function defeatIE() {if (document.all) {(message);return false;}} function defeatNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=defeatNS;} else{document.onmouseup=defeatNS;document.oncontextmenu=defeatIE;} document.oncontextmenu=new Function("return false")
        </script>

    </head>
    <body onload="resize()">

        <!-- Google Tag Manager -->
        <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-KL96JT"
                          height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
        <script>(function(w, d, s, l, i) {
                w[l] = w[l] || [];
                w[l].push({'gtm.start':
                            new Date().getTime(), event: 'gtm.js'});
                var f = d.getElementsByTagName(s)[0],
                        j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
                j.async = true;
                j.src = '//www.googletagmanager.com/gtm.js?id=' + i + dl;
                f.parentNode.insertBefore(j, f);
            })(window, document, 'script', 'dataLayer', 'GTM-KL96JT');</script>
        <!-- End Google Tag Manager -->

        <div id="fb-root"></div>
        <script>(function(d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id))
                    return;
                js = d.createElement(s);
                js.id = id;
                js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
                fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));
        </script>

        <div id="div-toTop" style="display: block;">
            <img src="<?php echo Yii::app()->request->baseUrl; ?>/icon/backtop.png">
        </div>



        <?php
        $baner = Yii::app()->cache->get('baner');
        if ($baner === FALSE) {
            $baner = Panel::model()->findAll(
                    array(
                        'condition' => ' `flag`=1 and `type` in(4,5) and `dateCreate`<= CURDATE() and `dateEpend`>=CURDATE() order by vitri ASC',
                        'limit' => 100,
                    )
            );
            Yii::app()->cache->set('baner', $baner, 7200);
        }
        if (!empty($baner)) {
            $lan = 0;
            $right = '';
            $flag = 0;
            $dem = 0;
            $dem1 = 0;
            $left = '';
            foreach ($baner as $b) {

                $h = 0;
                if ($b->type == 5) {
                    $lan = $lan + 1;

                    if ($b->kieu == 0) {
                        $h = 240;
                    } elseif ($b->kieu == 1) {
                        $h = 480;
                        $flag = 1;
                    }
                    if ($lan < 2) {
                        $left = $left . '<li><a href="' . $b->url . '" target="_blank" rel="nofollow"><img class="aut" title="' . $b->name . '" src="' . Yii::app()->request->baseUrl . '/upload/quangcao/' . $b->photo . '" width="180" height="' . $h . '"  border="0"></a>';
                    } elseif ($lan < 7) {
                        $left = $left . '<a href="' . $b->url . '" target="_blank" rel="nofollow"><img class="aut" title="' . $b->name . '" src="' . Yii::app()->request->baseUrl . '/upload/quangcao/' . $b->photo . '" width="180" height="' . $h . '"  border="0"></a>';
                    } elseif ($lan > 6) {
                        $left = $left . '<a href="' . $b->url . '" target="_blank" rel="nofollow"><img class="aut" title="' . $b->name . '" src="' . Yii::app()->request->baseUrl . '/upload/quangcao/' . $b->photo . '" width="180" height="' . $h . '"  border="0"></a></li>';
                        $dem = 0;
                    }
                } else {
                    $flag = 2;
                    if ($b->kieu == 0) {
                        $dem = $dem + 1;
                        $h = 240;
                        if ($dem < 2) {
                            $right = $right . '<li><a href="' . $b->url . '" target="_blank" rel="nofollow"><img class="aut" title="' . $b->name . '" src="' . Yii::app()->request->baseUrl . '/upload/quangcao/' . $b->photo . '" width="180" height="' . $h . '"  border="0"></a>';
                        } elseif ($dem < 7) {
                            $right = $right . '<a href="' . $b->url . '" target="_blank" rel="nofollow"><img class="aut" title="' . $b->name . '" src="' . Yii::app()->request->baseUrl . '/upload/quangcao/' . $b->photo . '" width="180" height="' . $h . '"  border="0"></a>';
                        } elseif ($dem > 6) {
                            $right = $right . '<a href="' . $b->url . '" target="_blank" rel="nofollow"><img class="aut" title="' . $b->name . '" src="' . Yii::app()->request->baseUrl . '/upload/quangcao/' . $b->photo . '" width="180" height="' . $h . '"  border="0"></a></li>';
                            $dem = 0;
                        }
                    } elseif ($b->kieu == 2) {

                        $h = 240 + 240;
                        if ($dem == 1) {
                            $dem = 0;
                            $right = $right . '<a href="' . $b->url . '" target="_blank" rel="nofollow"><img class="aut" title="' . $b->name . '" src="' . Yii::app()->request->baseUrl . '/upload/quangcao/' . $b->photo . '" width="180" height="' . $h . '"  border="0"></a></li>';
                        } else {
                            $dem = 3;
                            $right = $right . '<li><a href="' . $b->url . '" target="_blank" rel="nofollow"><img class="aut" title="' . $b->name . '" src="' . Yii::app()->request->baseUrl . '/upload/quangcao/' . $b->photo . '" width="180" height="' . $h . '"  border="0"></a>';
                        }
                    } elseif ($b->kieu == 3) {
                        $h = 792;
                        $right = $right . '<li><a href="' . $b->url . '" target="_blank" rel="nofollow"><img class="aut" title="' . $b->name . '" src="' . Yii::app()->request->baseUrl . '/upload/quangcao/' . $b->photo . '" width="180" height="' . $h . '"  border="0"></a></li>';
                    }
                }
            }
        }
        ?>

        <?php
        /*
          $a = Yii::app()->controller->action->id;
          echo '<br/> action '.$a;
          $b = Yii::app()->controller->id;
          echo '<br/> ctroler '.$b;
          echo '<br/>';
         */


        $this->renderPartial('//layouts/header');
        ?>


        <div id="nd" style="padding-top: 64px;" >


            <div class="Colum1">
                <?php
                if (!empty($left)) {
                    ?>
                    <ul id="mycarousel5" class="jcarousel-skin-chacha">
                        <?php echo $left; ?>
                       
                    </ul>


                    <?php
                }
                ?>
            </div>
            <div id="col" style="float: left;border: 1px slategray">
                <div class="noidungfix" id="content0">
                    <div>
                        <div class="colleft">
                            <?php
                            $this->renderPartial('//layouts/nabar_home');
                            ?>
                            <div style="clear: both"></div>
                        </div>

                        <div class="colright" style="margin: 0px;height: 379px;">

                            <?php
                            $this->renderPartial('//site/slider');
                            ?>

                            <div style="clear: both"></div>
                        </div>

                    </div>

                    <div  style="clear: both"></div>
                    <div id="to"></div>
                </div>
            </div>
            <div class="Colum3">
                <?php
                if (!empty($flag)) {
                    if ($flag > 1) {
                        ?>
                        <ul id="mycarousel1" class="jcarousel-skin-chacha">
                            <?php echo $right; ?>

                        </ul>
                        <?php
                    }
                }
                ?>
            </div>
            <div class="clear"></div>
            <div id="content1" style="margin-top: -1307px">
                <?php echo $content; ?>
                 <div class="clear"></div>
            </div>



             <div class="clear"></div>
            <?php
            $this->renderPartial('//layouts/footer');
            ?>
             <div class="clear"></div>
        </div>
        <div class="clear"></div>

        <div style="width:100%;height:66px;background:url(http://www.muahangtragop.com/plugins/snow/image/snow.png) center center no-repeat;position:fixed;bottom:0px;z-index:5"></div>

        <script type="text/javascript">
            $(function() {
                $(window).scroll(function() {
                    if ($(this).scrollTop() != 0) {
                        $('#div-toTop').fadeIn();
                    } else {
                        $('#div-toTop').fadeOut();
                    }
                });
                $('#div-toTop').click(function() {
                    $('body,html').animate({scrollTop: 0}, 800);
                });
            });
        </script>
        <!-- layzy load
        <script src="<php echo Yii::app()->request->baseUrl >/js/jquery.lazyload.js"></script>
       
        <script type="text/javascript" charset="utf-8">
            $(function() {
                $("img.lazy").lazyload({
                    effect: "fadeIn",
                    threshold: 200,
                    placeholder: "image/grey.gif"

                });
            });

        </script>
       --> 
       <div class="clear"></div>
       <!-- Quantcast Tag -->
<script type="text/javascript">
var _qevents = _qevents || [];

(function() {
var elem = document.createElement('script');
elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js";
elem.async = true;
elem.type = "text/javascript";
var scpt = document.getElementsByTagName('script')[0];
scpt.parentNode.insertBefore(elem, scpt);
})();

_qevents.push({
qacct:"p-Zw0FNWa3fNttE"
});
</script>

<noscript>
<div style="display:none;">
<img src="//pixel.quantserve.com/pixel/p-Zw0FNWa3fNttE.gif" border="0" height="1" width="1" alt="Quantcast"/>
</div>
</noscript>
<!-- End Quantcast tag -->
    </body>
</html>
